package com.mopa.qzonegallery;
import android.app.Activity;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.view.Display;
public class PhoneUtils {
	private static float   	mDensity;
	private static int  	mScreenW;
	private static int 		mScreenH;
	public static boolean getSdCardStates()
	{
		String state = Environment.getExternalStorageState();
		if (Environment.MEDIA_MOUNTED.equals(state) == false) {
			   return false;
		}
		else
			return true;
	}
	
	public static void init(Activity activiy)
	{
		Display display = activiy.getWindowManager().getDefaultDisplay();
		DisplayMetrics dm = new DisplayMetrics();
		display.getMetrics(dm);
		int h = display.getHeight();
		int w = display.getWidth();
		mScreenW = w;
		mScreenH = h;
		mDensity = dm.density;
	}
	public static int getScreenW()
	{
		return mScreenW;
	}
	
	public static int getScreenH()
	{
		return mScreenH;
	}
	public static int getRealPixel(int pxSrc)
	{
		return (int)(pxSrc*mDensity/1.5);
	}
	
	public static int getRealPixelW(int pxSrc)
	{
		return (int)(pxSrc*mScreenW/480);
	}
	
	public static int getRealPixelH(int pxSrc)
	{
		return (int)(pxSrc*mScreenH/800);
	}

}
